/**
 * 将嵌套数组转换为一维数组
 * @param {Array} arr
 */
export default function flat(arr) {
    if (!arr || arr.length === 0) return [];

    const result = [];
    for (let i = 0; i < arr.length; i++) {
        if (Array.isArray(arr[i])) {
            result.push(...flat(arr[i]));
        } else {
            result.push(arr[i]);
        }
    }
    return result;
}
